import 'package:flutter/material.dart';
import 'package:flutterproject/page/mine/children/assets/data/assets_detail_bean.dart';
import 'package:flutterproject/page/mine/children/assets/widget/card.dart';
import 'package:flutterproject/page/mine/children/assets/widget/list.dart';
import 'package:flutterproject/util/extension/int_extension.dart';

class ScoreTwoPage extends StatelessWidget {
  final AssetsDetailBean? bean;

  const ScoreTwoPage({super.key, required this.bean});

  @override
  Widget build(BuildContext context) {
    double result = ((bean?.balance ?? 0) + (bean?.frozen ?? 0)).toDouble();
    String? amount1 = "0";
    String? amount2 = "00";
    if (result.toString().contains(".") ?? false) {
      amount1 = result.toString().split(".")[0];
      amount2 = result.toString().split(".")[1];
    } else {
      amount1 = result.toString();
    }
    return Column(
      children: [
        CardWidget(
          image: 'assets/image/ic_bg_jf.png',
          title: "绿色积分",
          value: "$amount1",
          icon: '/image/ic_huizhang',
          value2: '$amount2',
        ),
        22.heightBox,
        Expanded(
          child: ListWidget(
            title: '绿色积分',
            list: bean?.list ?? [],
          ),
        ),
      ],
    );
  }
}
